package com.dfbz.dao;

import com.dfbz.dao.Base.BaseDao;
import com.dfbz.model.Dept;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;
import java.util.Map;

public class DeptDao extends BaseDao<Dept> {
    JdbcTemplate jdbcTemplate=getJdbcTemplate();
    public DeptDao() {
        super(Dept.class);
    }
    public List<Map<String,Object>> findAll(){
        String sql="select d.id as deptId,d.`name` as deptName," +
                "u.id as uId,u.username,u.real_name as realName " +
                "from dept d " +
                "left join user u on d.id = u.dept_id";
        return jdbcTemplate.queryForList(sql);
    }
}
